package com.hp.bon.sgw.wkflow.impl;

import java.util.HashMap;
import java.util.Map;

import com.hp.bon.sgw.wkflow.FlowVarObj;

/**
 * 根据CardPing字段获取 AreaCode
 * 
 * @author wuzhih
 * 
 */
public class CardPingAreaCodeVarObj extends FlowVarObj {

	public CardPingAreaCodeVarObj() {

	}

	@Override
	public Object getProperty(String express) {
		String areaCode = regionMap.get(Integer.valueOf(express.substring(0, 2)));
		if (null == areaCode) {
			throw new IllegalArgumentException("CardPin(" + express + ")  is illegal ,cannot find the area code");
		} else {
			return areaCode;
		}
	}

	public static final Map<Integer, String> regionMap = new HashMap<Integer, String>();
	static {
		regionMap.put(55, "551");
		regionMap.put(10, "010");
		regionMap.put(59, "591");
		regionMap.put(93, "931");
		regionMap.put(20, "020");
		regionMap.put(77, "771");
		regionMap.put(85, "851");
		regionMap.put(98, "898");
		regionMap.put(31, "311");
		regionMap.put(37, "371");
		regionMap.put(45, "451");
		regionMap.put(27, "027");
		regionMap.put(73, "731");
		regionMap.put(43, "431");
		regionMap.put(25, "025");
		regionMap.put(79, "791");
		regionMap.put(24, "024");
		regionMap.put(47, "471");
		regionMap.put(95, "951");
		regionMap.put(97, "971");
		regionMap.put(53, "531");
		regionMap.put(35, "351");
		regionMap.put(29, "029");
		regionMap.put(21, "021");
		regionMap.put(28, "028");
		regionMap.put(22, "022");
		regionMap.put(91, "891");
		regionMap.put(99, "991");
		regionMap.put(87, "871");
		regionMap.put(57, "571");
		regionMap.put(23, "023");
	}

}
